// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Vuescroll from 'vuescroll';
import 'vuescroll/dist/vuescroll.css';
import $ from 'jquery'
//axios.defaults.baseURL = 'http://139.159.147.237:8086';
axios.defaults.baseURL = 'http://localhost:8002';
Vue.prototype.HOST='/user'

Vue.config.productionTip = false
Vue.prototype.$axios = axios
Vue.use(ElementUI)
Vue.use(Vuescroll);
/* eslint-disable no-new */
router.beforeEach((to, from, next) => {
  if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
    console.log(localStorage.getItem("name"))
    console.log(localStorage.getItem("role"))
    console.log(to.meta.role==localStorage.getItem("role"))
    if (to.meta.role==localStorage.getItem("role")) {
      next()
    }else {
      localStorage.setItem("noPower","无访问权限")
    }
  } else {
    next();
  }
});
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})

